package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.TenantConsultDetailMapper;
import com.hgkj.cloud.base.dao.TenantConsultMapper;
import com.hgkj.cloud.base.domain.TenantConsult;
import com.hgkj.cloud.base.service.TenantConsultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class TenantConsultServiceImpl implements TenantConsultService {


	@Autowired
	private TenantConsultMapper consultMapper;

	@Autowired
	private TenantConsultDetailMapper consultDetailMapper;

	@Override
	public int deleteByPrimaryKey(Long id) {
		return consultMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(TenantConsult record) {
		return consultMapper.insert(record);
	}

	@Override
	public int insertSelective(TenantConsult record) {
		return consultMapper.insertSelective(record);
	}

	@Override
	public TenantConsult selectByPrimaryKey(Long id) {
		return consultMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(TenantConsult record) {
		return consultMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(TenantConsult record) {
		return consultMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<Map<String, Object>> listConsult(PageInfo pi, Map<String, Object> map) {
		if(pi != null){
			map.put("currentCount", pi.getCurrentCount());
			map.put("pageSize", pi.getPageSize());
		}
		return consultMapper.listConsult(map);
	}

	@Override
	public List<Map<String, Object>> listConsults(PageInfo pi, Map map) {
		if(pi != null){
			map.put("currentCount", pi.getCurrentCount());
			map.put("pageSize", pi.getPageSize());
		}
		return consultMapper.listConsults(map);
	}

	@Override
	public long getListConsultCount(Map<String, Object> map) {
		return consultMapper.getListConsultCount(map);
	}


	@Override
	public long getListByConsultIdCount(Map<String, Object> map) {
		return consultDetailMapper.getListByConsultIdCount(map);
	}

	@Override
	public List<Long> getListConsultCounts(Map<String, Object> map) {
		return consultMapper.getListConsultCounts(map);
	}

	@Override
	public int addPlaytour(Map<String, Object> map) {
		return consultMapper.addPlaytour(map);
	}

	@Override
	public Map<String, Object> findPsyPlaytourBymap(Map<String, Object> map) {
		return consultMapper.findPsyPlaytourBymap(map);
	}

	@Override
	public List<Map<String, Object>> listConsultDetail(PageInfo pi, Map<String, Object> map) {
		if(pi != null){
			map.put("currentCount", pi.getCurrentCount());
			map.put("pageSize", pi.getPageSize());
		}
		// TODO Auto-generated method stub
		return consultMapper.listConsultDetail( map);
	}

	@Override
	public long getListConsultDetailCount(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return consultMapper.getListConsultDetailCount(map);
	}

	@Override
	public List<Map<String, Object>> listConsultNew(PageInfo pi, Map<String, Object> map) {
		if(pi != null){
			map.put("currentCount", pi.getCurrentCount());
			map.put("pageSize", pi.getPageSize());
		}
		return consultMapper.listConsultNew(map);
	}

	@Override
	public long getListConsultCountNew(Map<String, Object> map) {
		return consultMapper.getListConsultCountNew(map);
	}

	@Override
	public Map<String, Long> getUserConsultCount(Map<String, Object> map) {
		return consultMapper.getUserConsultCount(map);
	}

	@Override
	public Long listDeviceReportsByUserCount(Map<String, Object> map) {
		return consultMapper.listDeviceReportsByUserCount(map);
	}

	@Override
	public List<Map<String,String>> getUserConsult(PageInfo pi,Map<String, Object> map) {
		if(pi != null){
			map.put("currentCount", pi.getCurrentCount());
			map.put("pageSize", pi.getPageSize());
		}
		return consultMapper.getUserConsult(map);
	}

	@Override
	public Long getUserConsultsCount(Map<String, Object> map) {
		return consultMapper.getUserConsultsCount(map);
	}

	@Override
	public List<Map<String, Object>> listDeviceReportsByUser(Map<String, Object> map) {
		return consultMapper.listDeviceReportsByUser(map);
	}


}
